<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>canvas直线</title>
	</head>
	<body>
		<canvas id="myCanvas" width="300" height="100" style="border:1px solid #c3c3c3;">
			
		</canvas>
		<script>
			var c = document.getElementById("myCanvas");
			var ctx = c.getContext("2d");
			ctx.moveTo(0, 0);
			ctx.lineTo(300, 100);
			ctx.stroke();
		</script>
	</body>
</html>